package com.shen.GOF.prototype;

import java.util.Date;
//原型模式

/**
 * 1.实现一个接口 Cloneable
 * 2.重写一个方法 clone()
 */
public class Video2 implements Cloneable {
    private String name;
    private Date createTime;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Object clone = super.clone();
        Video2 v = (Video2) clone;
        v.createTime= (Date) this.createTime.clone();
        return clone;
    }


    public Video2() {
    }

    public Video2(String name, Date createTime) {
        this.name = name;
        this.createTime = createTime;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public String toString() {
        return "Video{" +
                "name='" + name + '\'' +
                ", createTime=" + createTime +
                '}';
    }
}
